package o;

import android.database.MatrixCursor;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appmarket.service.deamon.bean.DownloadHistory;
import com.huawei.appmarket.service.deamon.download.remote.DownloadAgentService;

public final class eus {
    public static MatrixCursor ˏ(String str, int i) {
        int ॱᐝ;
        int i2;
        int i3 = -99;
        for (SessionDownloadTask sessionDownloadTask : dvt.ˏ().ͺ()) {
            ॱᐝ = sessionDownloadTask.ॱᐝ();
            String ˊˊ = sessionDownloadTask.ˊˊ();
            if (ॱᐝ == i && ˊˊ.equals(str)) {
                int ˈ = sessionDownloadTask.ˈ();
                ॱᐝ = sessionDownloadTask.ʼॱ();
                i2 = ˈ;
                break;
            }
        }
        i2 = -99;
        ॱᐝ = -99;
        if (i2 == -99 && ॱᐝ == -99) {
            ˈ = -99;
            i3 = i2;
            for (DownloadHistory downloadHistory : dsv.ˊ()) {
                int ॱॱ = downloadHistory.ॱॱ();
                String ˋ = downloadHistory.ˋ();
                if (ॱॱ == i && ˋ.equals(str)) {
                    switch (((cdg) cdb.ॱ(cdg.class)).ˋ(downloadHistory.ˋ())) {
                        case -2:
                        case -1:
                            i2 = 4;
                            i3 = -1;
                            break;
                        case 0:
                        case 12:
                        case 13:
                            i2 = 4;
                            i3 = 2;
                            break;
                        case 1:
                        case 2:
                        case 11:
                            i2 = 4;
                            i3 = 1;
                            break;
                        case 10:
                            i2 = 4;
                            i3 = 0;
                            break;
                        default:
                            i2 = 4;
                            i3 = 2;
                            break;
                    }
                }
                i2 = i3;
                i3 = ˈ;
                ˈ = i3;
                i3 = i2;
            }
            i2 = i3;
            i3 = ˈ;
        }
        MatrixCursor matrixCursor = new MatrixCursor(new String[]{DownloadAgentService.PACKAGE_NMAE_ARG, "versioncode", "downloadstatus", "installstatus", "progress"}, 1);
        matrixCursor.addRow(new Object[]{str, Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(ॱᐝ)});
        return matrixCursor;
    }
}
